Skip to content

Conversation

@parsa-rahbari-82
Copy link

Description:

This pull request provides a series of important updates to the DeepONet project, primarily focusing on improving model accessibility and bug fixes. The following changes have been made:

  1. Command-Line Model Parameters:

    • Added command-line arguments to give users more control over the model configuration without needing to modify the source code directly.
    • Users can now adjust critical parameters such as learning rate, number of sensors, and training epochs via the command line using Python's argparse library.

    Example usage:

    python deeponet_pde.py -p ode -m 200 --num-train 10000 --num-test 3000--lr 1e-3 --epochs 50000 --nn deeponet --activation relu --init Glorot --stacked False

  2. Checkpoint Restoration Bug Fix:

    • Resolved a bug related to restoring checkpoints, which was caused by an incorrect file path.
    • The model can now properly restore from saved states for both training and inference.
  3. Legendre Transform Flexibility:

    • Replaced the hardcoded time value (T=2) with a dynamic time variable.
    • This update ensures that the model can work with any time interval, providing flexibility and preventing extrapolation errors.
  4. Compatibility with DeepONet’s Dynamic Systems:

    • Updated the structure of X_train and ensured proper formatting for X_test to be compatible with TensorFlow's compat.v1 backend.
    • Added necessary changes to avoid type mismatch errors, such as casting arrays in X_test to np.float32.

    Example code snippet:

X_test = tuple([arr.astype(dtype=np.float32) for arr in X_test])

Testing:

These changes have been thoroughly tested and confirmed to work reliably with TensorFlow's compat.v1 backend.

MIND Lab:

  • Supervisor: Dr. Mostafa Abbaszadeh
    Team:
    • AmirAli Fakhari Zavareh
    • Melika Taheri Soufi
    • Parsa Rahbari

@parsa-rahbari-82
Copy link
Author

Dear Dr. Lu
Thanks for the review! I’ve addressed the points you raised:

  • Redundant python 2 removed.
  • .gitignore file removed.
  • Using original order of import.

@parsa-rahbari-82
Copy link
Author

I reordered imports according to PEP 8 guidelines.

- .gitignore
- requirements.txt
@@ -1,8 +0,0 @@
deepxde
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this file as the original one.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AmirAliFakhari It seems the file roolls back to the wrong version.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear Mr. Lu Lu,

I hope you're doing well. I've been working on the DeepONet project for the past few months and truly appreciate your feedback throughout the process.

To help streamline the next steps and avoid back-and-forth revisions, would it be possible for you to share a complete list of the issues or changes you'd like to see in the current version? This would really help me address everything thoroughly and ensure that the final result meets your expectations.


import deepxde as dde
import numpy as np
import tensorflow as tf
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import argparse
import deepxde as dde
import itertools
import numpy as np
import tensorflow as tf

from spaces import FinitePowerSeries, FiniteChebyshev, GRF
from system import LTSystem, ODESystem, DRSystem, CVCSystem, ADVDSystem
from utils import merge_values, trim_to_65535, mean_squared_error_outlier, safe_test
from spaces import GRF, FiniteChebyshev, FinitePowerSeries
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from spaces import FiniteChebyshev, FinitePowerSeries, GRF

X_test = merge_values(X_test)
y_pred = model.predict(data.transform_inputs(X_test))
X_test = tuple([arr.astype(dtype=np.float32) for arr in X_test])
y_pred = model.predict(X_test)
Copy link
Owner

@lululxvi lululxvi Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no data.transform_inputs? This is for data normalization.

# Gravity pendulum
# k = 1
# return [s[1], - k * np.sin(s[0]) + u]
k = 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is return in line 108. The code here is not used.

from __future__ import print_function

import numpy as np
import config
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config is a local file. Move it below as the original code.


import sys
import time
import numpy as np
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the original import format for numpy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants